home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 1.iso / util / tsh091.zip / WSIZE.C < prev    next >
Text File  |  1994-03-06  |  1KB  |  48 lines

  1. /*
  2.  *  wsize - A program to show or change the size of a tkern window.
  3.  *
  4.  *  Copyright (C) 1994  Troy Rollo <troy@cbme.unsw.EDU.AU>
  5.  *
  6.  *  This program is free software; you can redistribute it and/or modify
  7.  *  it under the terms of the GNU General Public License as published by
  8.  *  the Free Software Foundation; either version 2 of the License, or
  9.  *  (at your option) any later version.
  10.  *
  11.  *  This program is distributed in the hope that it will be useful,
  12.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  *  GNU General Public License for more details.
  15.  *
  16.  *  You should have received a copy of the GNU General Public License
  17.  *  along with this program; if not, write to the Free Software
  18.  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  */
  20.  
  21. #include <stdio.h>
  22. #include <sys/ioctl.h>
  23. #include <ctype.h>
  24. #include <stdlib.h>
  25.  
  26. int
  27. main(    int    argc,
  28.     char    **argv)
  29. {
  30.     struct    winsize    wsize;
  31.  
  32.     if (argc < 3)
  33.     {
  34.         ioctl(0, TIOCGWINSZ, &wsize);
  35.         printf("%d Columns, %d Rows\n(%d x %d pixels)\n",
  36.             wsize.ws_col, wsize.ws_row,
  37.             wsize.ws_xpixel, wsize.ws_ypixel);
  38.     }
  39.     else
  40.     {
  41.         wsize.ws_col = atoi(argv[1]);
  42.         wsize.ws_row = atoi(argv[2]);
  43.         wsize.ws_xpixel = wsize.ws_ypixel = 0;
  44.         ioctl(0, TIOCSWINSZ, &wsize);
  45.     }
  46.     return 0;
  47. }
  48.